A good answer might be:

Yes—but not with files. Input has been text from the keyboard and output has been text to the monitor.


Redirecting Output

Any java program that sends its output to the monitor can send its output to a file using output redirection. Say that you have a program named hello.java that writes "Hello World" to the monitor. Here is how the program usually works:

C:\> java hello
Hello World
C:\>

Without making any change you can do the following:

C:\> java hello > output.txt
C:\> 

This command creates the file called output.txt and fills it with the characters that otherwise would go to the monitor. You can pick any name you want for the output file (but do not pick a name already in use in the subdirectory because the new file will replace the old file.) You do not have to end the file name with ".txt" but doing that is a helpful reminder about what the file contains. When the program finishes, the file output.txt remains on the disk. For example:

C:\>type output.txt
Hello World
C:\> 

The TYPE command given at the command shell asks the operating system to type the file out on the monitor. It works with any text file.

QUESTION 8:

Can Notepad be used to edit output.txt?